import { request } from '@umijs/max';

// 获取城市列表
export async function getCityList() {
  return request('/api/city/list', {
    method: 'GET',
  });
}

// 根据城市获取小区列表
export async function getCommunityListByCity(city: string) {
  return request('/api/community/listByCity', {
    method: 'GET',
    params: { city },
  });
}

// 创建新小区
export async function createCommunity(data: {
  name: string;
  address: string;
  latitude: number;
  longitude: number;
  description?: string;
  city: string;
}) {
  return request('/api/community/create', {
    method: 'POST',
    data,
  });
}
